<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script src="jquery-3.5.1.js" charset="utf-8"></script>

    <script>
        /*
        let p = new Promise(function (resolve, reject) {
            // resolve 解决
            // reject 拒绝

            $.ajax({
                url: 'data/1.text',
                dataType: 'json',
                success(arr){
                    resolve(arr);
                },
                error(res){
                    reject(res);
                }
            });
        });

            p.then(arr => {
                alert('成功');
                console.log(arr);
            }, res => {
                alert('失败');
                console.log(res);
            });
        */

        $.ajax({
            url: 'data/2.text',
            dataType: 'json',
        }).then(arr => {
            alert('成功');
            console.log(arr);
        }, res => {
            alert('失败');
            console.log(res);
        });

    </script>

</head>
<body>

</body>
</html>